﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace PES_TurnierManager
{
    /// <summary>
    /// Interaktionslogik für MatchResultEntryDialog.xaml
    /// </summary>
    public partial class MatchResultEntryDialog : Window
    {
        private bool mDialogResult;
        public MatchResultEntryDialog()
        {
            InitializeComponent();
            mDialogResult = false;
        }

        public void setMatchName(string matchName)
        {
            mMatchBlock.Text = matchName;
        }

        public string getHomeScore()
        {
            return mHomeBox.Text;
        }

        public string getGuestScore()
        {
            return mGuestBox.Text;
        }

        public bool getDialogResult()
        {
            return mDialogResult;
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button button = (Button)sender;
            if(button.Name.Equals("mOKButton") &&
               !mHomeBox.Text.Equals("") && !mGuestBox.Text.Equals(""))
            {
                mDialogResult = true;
            }
            else if (button.Name.Equals("mCancelButton"))
            {
                mDialogResult = false;
            }
            Close();
        }

        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                if (!mHomeBox.Text.Equals("") && !mGuestBox.Text.Equals(""))
                {
                    mDialogResult = true;
                    Close();
                }
            }
        }
    }
}
